const express = require("express");
const router = express.Router();
const article_handle = require("../router-handler/article");
const {
  addArticleRules,
  deleteArticleRules,
  updateCateRules,
  validate,
} = require("../schema/article.js");
// 获取文章分类
router.get("/cate", article_handle.getCateList);

// 新增文章分类
router.post(
  "/cate",
  addArticleRules(),
  validate,
  article_handle.addArticleCate
);
// 删除文章分类
router.get(
  "/deleteArticle/:id",
  deleteArticleRules(),
  validate,
  article_handle.deleteArticle
);

// 根据id获取文章分类接口
router.get(
  "/getCateListById/:id",
  deleteArticleRules(),
  validate,
  article_handle.getCateListById
);
// 根据id更新分类文章数据
router.post(
  "/updateCate",
  updateCateRules(),
  validate,
  article_handle.updateCateById
);
module.exports = router;
